//
//  IntroView.m
//  Double
//
//  Created by 袁庆秋 on 15/5/25.
//  Copyright (c) 2015年 袁庆秋. All rights reserved.
//

#pragma mark -
#pragma mark 动画详情页面下半部分自定义View， 放置“简介”信息

#import "IntroView.h"

@implementation IntroView

- (void)dealloc
{
    [_introLabel release];
    [_scroll release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, self.frame.size.height)];
//        self.scroll.contentSize = CGSizeMake(self.frame.size.width, self.frame.size.height * 1.5);
        [self addSubview:self.scroll];
        
        self.introLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.scroll.frame.size.width, 1)];
        self.introLabel.numberOfLines = 0;
//        [self.introLabel setBackgroundColor:[UIColor redColor]];
        [self.scroll addSubview:self.introLabel];
        
    }
    return self;
}

- (void)zidingyiScroll:(NSString *)str
{
    NSString *myStr = str;
    //定义一个字典将他的字体大小名 系统大小为17
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:17]};
    //字数宽度 最高1000
    CGRect rect = [myStr boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width - 20, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    self.introLabel.numberOfLines = 0;
    [self.introLabel setFrame:CGRectMake(5, 5, [UIScreen mainScreen].bounds.size.width - 20,rect.size.height)];
    self.introLabel.text = str;
    self.scroll.contentSize = CGSizeMake(10, rect.size.height+40);
}
@end
